function ParamWN = DefParam
%DefParam - Definition of parameters to be used within WADENOW toolbox
%
%       ParamWN = DefParam
%
% ParamWN is a struct variable whose fields are:
%
% Wavelet        : wavelet. Possible values: 'amor' (MATLAB default) and 
%                  'morlet' (analytic morlet whose Parameters can be user 
%                  defined). If a string different from 'amor' and 'morlet'
%                  is chosen, 'amor' is used.
% F0             : central frequency (cpd) of the complex oscillation 
%                  (default: 6/(2*pi), to have omega0 = 6).
% Sigmat         : Parameter of the Gussian bell with tapers the complex 
%                  oscillation (default: 1). 
%                  Note: the Parameters F0 and Sigmat are active only if 
%                  the option 'morlet' is chosen.
%
% Fs             : sampling frequency (24 cpd, i.e. 1h sampling time)
%
% VoicesPerOctave: voices per octave, i.e. number of intermediate scales in 
%                  an octave, i.e. a frequency doubling. 
%
% Na             : the starting date of the scalograms related to tc(k) is
%                  tc(k)-Na, where Na is expressed in days, provided that 
%                  the segment tc(k)-Na completely belongs to the time series
%                  (if this condition is not fulfilled, the corresponding 
%                  scalogram is not computed).
% Nb             : the ending date of the rainfall scalogram related to tc(k)
%                  is tc(k)+Nb, where Nb is expressed in days, under the 
%                  condition that tc(k)+Nb completely belongs to the times
%                  series (if such a condition is not fulfilled, the 
%                  scalogram is not computed).
%                  The ending date of the velocity scalogram always is t(k).
%
% Nc             : number of days to be considered before tc for the trend
%                  classification. If it is empty, it is Nc = 5.
% Nd             : number of days to be considered after tc for the trend 
%                  classification. If it is empty, it is Nd = 5.
%
% NPerDay        : number of scalograms (i.e. of computation times tc) per 
%                  day. The allowed values are 1 (one scalogram per day at 
%                  0h), 2 (two scalograms at 0h and 12 h), 3 (0h, 8h, 16h), 
%                  4 (0h, 6h, 12h, 18h), 6 (0h, 4h, 8h, 12h, 16h, 18h, 20h),
%                  12 (even hours), 24.
%
% DateIn         : initial date for which the scalograms are computed (this
%                  date must be expressed as serial number). The start time 
%                  of the first computed scalogram is max(DateIn-Na,t(1)),
%                  where t is the time vector of the input time series. 
%                  If DateIn is undefined of empty, DateIn = t(1).
% DateFin        : final date for which the scalograms are computed (this
%                  date must be expressed as serial number). The end time 
%                  of the last computed scalogram is min(DateFin+Nb,t(end)). 
%                  If DateFin is undefined of empty, DateFin = t(end).
%
% Vmh            : scalar/vector/matrix for the management of thresholds 
%                  for the time series segments classification. Options:
%                  - Vmh is a scalar. in this case, 4-levels classification
%                    (including transitions) is carried out, according to: 
%                       1: L, 2: L->H, 3: H, 4: H->L, 
%                    with the threshold VH = Vmh.
%                  - Vmh is a 2-elements vector. In this case, a 7-levels
%                    classification is carried out with the thresholds 
%                    VM = Vmh(1) and VH = Vmh(2) (the vector is sorted in
%                    ascending order). The levels L, M and H are characterized
%                    by the conditions V<=M, M<V<=H and V>H respectively. The
%                    outputs are: 
%                       1: L, 2: L->M, 3: M, 4: M->H (or also L->H),
%                       5: H, 6: H->M, 7: M->L (or also H->L).
%                  - Vmh is a 2-column matrix Vmh = [t VH], where VH(h) is
%                    the time-dependent threshold at t(h), as in the first
%                    case (four level output).
%                  - Vmh is a 3-column matrix Vmh = [t VM VH], where VM(h) 
%                    and VH(h) are the time-dependent threshold at t(h), as 
%                    in the second case.
%
% SigmaDA        : standard deviation of rainfall and velocity to be used
%                  in data augmentation. If length(SigmaDA) == 2, it is
%                  sigmaR = SigmaDA(1) and sigmaV = SigmaDA(2). If SigmaDA
%                  is a scalar, it is sigmaR = SigmaDA. Please note that
%                  sigmaDA must be coherent with the used signal.
%                  If sigmaDA is undefined or empty, it can be managed in
%                  an interactive way.
%
% CNNmodel       : allowed strings: 'alexnet', 'vgg16', 'vgg19', 'googlenet',
%                  'resnet18'. If no a correct string is chosen, the default
%                  choice 'vgg19' is used.
% SizeIm         : image size. Such a field is automatically defined on the
%                  basis of the chosen CNNmodel. 
%
% VectPart       : 3-elements vector such that VectPart(1) is the fraction 
%                  of images for training, VectPart(2) is the fraction for 
%                  validation and VectPart(3) is the fraction for test.
%                  The condition sum(VectPart) <= 1 must be satisfied.
%                  If vectPart is empty or the condition about sum(VectPart) 
%                  is not satisfied, VectPart = [0.7 0.15 0.15] is used.
%
% ComPart        : Common part of scalogram filenames (folder name, common 
%                  part of the filename). Each filename is completed with  
%                  the date string. For example, if ComPart is the string 
%                       'pluvioData\LongBeach15days', 
%                  the filename of the scalogram whose computation date is 
%                  15 march 2020, 12:00:00 is the string
%                    'pluvioData\LongBeach15days_15-Mar-2020-120000.jpg'.
%                  If comPart is empty, ComPart = '' is used.
%
% FoldOut        : General folder of classified scalograms. For each level
%                  Lk (k=1:4 if Vmh is a scalar or a 2-columns matrix,  
%                  or k=1:8 if Vmh is a vector or a 3-columns matrix), a 
%                  nested folder whose name is Lk is generated and the
%                  corresponding output scalogram images are placed here.
%
% MiniBatchSize  : Parameter for CNN training (default: 10). 
%
% MaxEpoch       : Parameter for CNN training.
%
%   ParamWN = DefParam
%
% See also DefParamInteractive.

% G. Teza, 2020

ParamWN.Wavelet = 'amor';            
if ~ismember(ParamWN.Wavelet,{'amor','morlet'})
    ParamWN.Wavelet = 'amor';
end
% ParamWNeters f0 and sigmat act only is wavelet is amor   
ParamWN.F0 = 6/(2*pi);  
ParamWN.Sigmat = 1;

ParamWN.Fs = 24;

ParamWN.VoicesPerOctave = 24;

ParamWN.Na = 15;
if isempty(ParamWN.Na), ParamWN.Na = 15; end

ParamWN.Nb = 2;
if isempty(ParamWN.Nb), ParamWN.Nb = 2; end

ParamWN.Nc = 5;
if isempty(ParamWN.Nc), ParamWN.Nc = 5; end

ParamWN.Nd = 5;
if isempty(ParamWN.Nd), ParamWN.Nd = 5; end

ParamWN.NPerDay = 12;
if isempty(ParamWN.NPerDay)||~ismember(ParamWN.NPerDay,[1 2 3 4 6 12 24])
    ParamWN.NPerDay = 1;
end

ParamWN.DateIn = datenum(2018,1,1);
ParamWN.DateFin = []; 

ParamWN.Vmh = [0.007 0.02];

ParamWN.SigmaDA = [6 0.002];

ParamWN.CNNmodel = 'vgg19';
chCNNmodel = lower(ParamWN.CNNmodel);
if ~ismember(chCNNmodel,{'alexnet','vgg16','vgg19','googlenet','resnet18'})
    chCNNmodel = 'vgg19';
end
ParamWN.CNNmodel = chCNNmodel;

if strcmp(chCNNmodel,'alexnet')
    SizeIm = [227 227];
else
    SizeIm = [224 224];
end
ParamWN.SizeIm = SizeIm;

ParamWN.VectPart = [0.6 0.2 0.2];
if sum(ParamWN.VectPart) > 1
    ParamWN.VectPart = [0.7 0.15 0.15];
end

ParamWN.ComPart = 'OutScalogramR\Pera';
if isempty(ParamWN.ComPart), ParamWN.ComPart = ''; end

ParamWN.FoldOut = 'OutFolderR'; 
if isempty(ParamWN.FoldOut), ParamWN.FoldOut = ''; end

ParamWN.MiniBatchSize = 10;
ParamWN.MaxEpochs = 1;